home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 10248 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.9 KB  |  39 lines

  1. Newsgroups: comp.lang.c++
  2. Path: ncrgw2.ncr.com!ncrhub2!lznj2!lziss3!netnews
  3. From: Arnold Bursian <arnold.bursian@germany.ncr.com>
  4. Subject: Re: how to delete data in file? help
  5. Content-Type: text/plain; charset=us-ascii
  6. Message-ID: <313DCA0B.8EA@germany.ncr.com>
  7. Sender: netnews@lziss3.lincroftnj.ncr.com (51[news]-Netnews Admin)
  8. Content-Transfer-Encoding: 7bit
  9. Organization: AT&T GIS Lincroft, NJ USA
  10. References: <4helpk$50c@lantana.singnet.com.sg>
  11. Mime-Version: 1.0
  12. Date: Wed, 6 Mar 1996 17:23:23 GMT
  13. X-Mailer: Mozilla 2.0GoldB1 (Win95; I)
  14.  
  15. Mikhail Choo W.M. wrote:
  16. > HI there,
  17. >    I know this may seem like a real stupid question, but I had to ask. If say
  18. > for example I needed to delete a string of data form a file, how do I go about
  19. > doing it. I can't just write over the data to delete, because the result would
  20. > be a file of the same length with white space chracters. So how does one delete
  21. > the data in such a way that once the data segment is deleted, the rest of the
  22. > data would neatly pack themselves over the deleted area to  ensure a release of
  23. > space. I know one way to solve the problem, but it seems very long-winded. The
  24. > method involves reading all the data in the file to memory, deleteing the
  25. > unwanted area, and the re-write the data back to clean file. I am currently
  26. > using Borland C++ 4.5, and I can't find any function that does the job. OK OK,
  27. > to summerise, the problem is that I can't seem to find a way to directly delete
  28. > a data segment form a file, without reading into memory first. So any ideas, and
  29. > help would be greatly appreciated. Thanks in advance .
  30. > --------------------------------------------------------
  31. > Yours, Mikhail Choo W. M.
  32. >                                    Carpedium!
  33. > E-Mail: mikhail@singnet.com.sg        sieze the day...
  34. >         s7700017@singnet.com.sg
  35. > --------------------------------------------------------
  36.  
  37. You can't. A data-file is a stream. You can' insert into it and you can't delete from it
  38.